<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellpadding="4" cellspacing="0" bordercolor="#000" style="width: 100%">
          <tr>
            <th colspan="33">
              <div style="position: relative;text-align: center">
                <img src="@/assets/reportIcon.png" width="100px" height="25px" style="position: absolute;left: 0px;top:-2px"/>
                <span>{{reportData.title}}</span>
              </div>
            </th>
          </tr>
          <tr>
            <td colspan="9">{{ reportData.datePurchase }}</td>
            <td colspan="8">文件编号：{{ reportData.documentNumber }}</td>
            <td colspan="8">保存期限：1年</td>
            <td colspan="8">版本1.0</td>
          </tr>
          <tr>
            <td colspan="2">项目/日期</td>
            <td v-for="i in 31">{{i}}</td>
          </tr>

          <tr>
            <td colspan="2">{{reportData.tableNameCode === 'soldering_iron_check' ? '烙铁编号：' : '锡炉编号：'}}</td>
            <td v-for="i in reportData.dayList[reportData.tableNameCode === 'soldering_iron_check' ? '烙铁编号' : '锡炉编号']">{{ i.inspectionResults }}</td>
          </tr>
          <tr>
            <td colspan="2">点检时间：</td>
            <td v-for="i in reportData.dayList['点检时间']">{{ i.inspectionResults }}</td>
          </tr>
          <tr>
            <td colspan="2">设定温度：</td>
            <td v-for="i in reportData.dayList['设定温度']">{{ i.inspectionResults }}</td>
          </tr>
          <tr v-if="reportData.tableNameCode === 'soldering_iron_check'">
            <td colspan="2">实际温度：</td>
            <td v-for="i in reportData.dayList['实际温度']">{{ i.inspectionResults }}</td>
          </tr>

          <tr>
            <td colspan="2">点检人员：</td>
            <td v-for="i in reportData.dayList['点检时间']">{{ i.maintainer }}</td>
          </tr>
          <tr>
            <td colspan="33">点检项目：</td>
          </tr>
          <tr v-if="reportData.ironObj.ironName.length > 0">
            <td :rowspan="reportData.ironObj.ironName.length">日保养</td>
            <td>{{reportData.ironObj.ironName[0]}}</td>
            <td v-for="i in reportData.ironObj.ironCheckLis[0]">{{ i.inspectionResults }}</td>
          </tr>
          <tr v-for="(item,index) in reportData.ironObj.ironName.slice(1)" v-if="reportData.ironObj.ironName.length > 0">
            <td>{{item}}</td>
            <td v-for="i in reportData.ironObj.ironCheckLis[index+1]">{{ i.inspectionResults }}</td>
          </tr>
          <tr v-if="reportData.weekCheckName.length > 0">
            <td :rowspan="reportData.weekCheckName.length + 2">周保养</td>
            <td></td>
            <td colspan="8" style="text-align: center">第一周</td>
            <td colspan="8" style="text-align: center">第二周</td>
            <td colspan="8" style="text-align: center">第三周</td>
            <td colspan="7" style="text-align: center">第四周</td>
          </tr>
          <tr v-if="reportData.weekCheckName.length > 0">
            <td></td>
            <td colspan="4">点检人员</td>
            <td colspan="4">审核</td>
            <td colspan="4">点检人员</td>
            <td colspan="4">审核</td>
            <td colspan="4">点检人员</td>
            <td colspan="4">审核</td>
            <td colspan="4">点检人员</td>
            <td colspan="3">审核</td>
          </tr>
          <tr v-for="item in reportData.weekCheckName" v-if="reportData.weekCheckName.length > 0">
            <td>{{item}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][0].maintainer}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][0].reviewer}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][1].maintainer}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][1].reviewer}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][2].maintainer}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][2].reviewer}}</td>
            <td colspan="4">{{reportData.weekCheckList[0][3].maintainer}}</td>
            <td colspan="3">{{reportData.weekCheckList[0][3].reviewer}}</td>
          </tr>
          <tr v-if="reportData.monthCheckName.length > 0">
            <td :rowspan="reportData.monthCheckName.length + 1">月保养</td>
            <td>保养项目</td>
            <td colspan="24">完成在对应栏中打"√"未完成打"X",如有异常请阐述</td>
            <td colspan="4">保养人</td>
            <td colspan="3">稽查人</td>
          </tr>
          <tr v-for="(item,index) in reportData.monthCheckName" v-if="reportData.monthCheckName.length > 0">
            <td>{{item}}</td>
            <td colspan="24">{{reportData.monthCheckList[0][0].inspectionResults}}</td>
            <td colspan="4">{{reportData.monthCheckList[0][0].maintainer}}</td>
            <td colspan="3">{{reportData.monthCheckList[0][0].reviewer}}</td>
          </tr>
          <tr>
            <td colspan="2">注意事项</td>
            <td colspan="31">
              {{reportData.beCareful}}
            </td>
          </tr>
        </table>
      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** 烙铁温度点检表 **/
  name: 'IronTemperatureSpotCheck',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    },
    type:{
      type:String,
      default:''
    }
  },
  data(){
    return {
      dayCheckList:[
        {
          checkName:'1.温度测试是否正常',
          measure:'1'
        },
        {
          checkName:'2.烙铁头表面是否完好',
          measure:'2'
        },
        {
          checkName:'3.烙铁周围是否清洁',
          measure:'2'
        },
      ],
      weekCheckList:[
        {
          checkName:'X/Y轴滑动是否正常',
          val:'1'
        },
        {
          checkName:'机械部分有无异响',
          val:'2'
        },
        {
          checkName:'各电磁阀气缸是否正常工作',
          val:'3'
        }
      ],
      monthCheckList:[
        {
          checkName:'传送皮带清洁张力检查',
          val:'1'
        },
        {
          checkName:'X/Y/Z轴丝杆加油',
          val:'1'
        },
      ]
    }
  }
}
</script>

<style scoped>

</style>